<template>
  <div>
    <content_top title="出纳期反结账" nextMonth="1"></content_top>

    <div class="g_box">
      <div class="g_head">
        <h3>出纳期末结账</h3>
      </div>
      <div class="g_box_last">
        <div class="last_icon">
          <Icon
            type="ios-information-circle-outline"
            size='100'
           :color="err_msg==''?'#20b2aa':'#ff0000'"
          />
        </div>
        <div class="last_date">
          <span>当前反结账期为：</span>
          <DatePicker :value="date_month" type="month" placeholder="选择月份" style="width: 200px;" @on-change="month_change" ></DatePicker>
        </div>
        <p class="last_confirm">反结账后系统将重新开放新增修改该月份出出纳板块数据，请谨慎操作。</p>

        <div class="last_btn">
        <p style="color:red;font-size: 13px;">*该功能仅能由权限管理员操作</p>
			<p v-if="err_msg" style="color:red;font-size: 13px;margin-top:15px;">{{err_msg}}</p>
			<div class="btn_chuna"><Button @click="handleChuna">出纳期反结账</Button></div>
        </div>
      </div>
    </div>

  </div>
</template>

<script>


export default {
  name: "balance_fan",
  data() {
    let self = this;
    return {
		date_month: new Date().Format('yyyy-MM'),
		err_msg:''
    };
  },
  created() {},
  methods: {
    month_change(date) {
		this.date_month = date;
    },
    handleChuna() {
		var self = this;

		var postdata = {
			date_month:this.date_month
		};

		Whttp.load("Chuna/Checkout/balance_fan", postdata, function(result) {
			self.err_msg = '';
			alert('反结账成功');
		},function(result){
			self.err_msg = result.message;
		});
    },
  }
};
</script>
<style scoped>
.g_box_last {
  width: 600px;
  padding: 20px;
  margin: 20px auto 100px;
  font-size: 16px;
}
.last_icon {
  margin: 40px 0;
  text-align: center;
}
.last_confirm {
  margin: 30px 0 15px;
}
.last_btn {
  text-align: center;
}
.last_btn button {
  width: 350px;
  color: #fff;
  font-size: 18px;
  background-color: #1abc9c;
}
.btn_chuna {
  margin-top: 30px;
}
</style>